package com.kk.permission.huawei;

import android.content.Context;
import android.text.TextUtils;

import com.kk.permission.GuideConst;
import com.kk.permission.handler.ConfigHandler;
import com.kk.permission.progress.ProgressUtil;
import com.kk.permission.utils.BaseUtil;
import com.kk.permission.utils.PrefUtil;
import com.kk.permission.utils.callershow.CallerShowSPUtils;

public class HuaweiTool {
    private static String mAppName;

    public static String getAppName() {
        if (TextUtils.isEmpty(mAppName)) {
            mAppName = ConfigHandler.getInstance().getAppName();
        }
        return mAppName;
    }

    public static Context getContent() {
        return BaseUtil.getAppContext();
    }

    public static void actionDialNotiDone() {
        PrefUtil.setKey("done_setted_dial_noti_permission", true);
        ProgressUtil.sendFinishEvent(GuideConst.DIAL_NOTI_PERMISSION);
    }

    public static void actionFloatWindowDone() {
        PrefUtil.setKey("done_setted_toast_permission", true);
        PrefUtil.setKey("toast_opened", true);
        ProgressUtil.sendFinishEvent(GuideConst.TOAST_PERMISSION);
    }

    public static void actionShortCutDone() {
        PrefUtil.setKey("done_setted_install_short_cut", true);
        ProgressUtil.sendFinishEvent(GuideConst.INSTALL_SHORT_CUT);
    }

    public static void actionAutoStartDone() {
        PrefUtil.setKey("done_setted_autoboot_permission", true);
        CallerShowSPUtils.setParam(BaseUtil.getAppContext(), "done_setted_autoboot_permission", Boolean.valueOf(true));
        CallerShowSPUtils.setParam(BaseUtil.getAppContext(), "setted_autoboot_permission", Boolean.valueOf(true));
        ProgressUtil.sendFinishEvent(GuideConst.AUTOBOOT_PERMISSION);
    }

    public static void actionBackgroundProtectDone() {
        PrefUtil.setKey("done_setted_background_protect_permission_lock", true);
        ProgressUtil.sendFinishEvent(GuideConst.BACKGROUND_PROTECT_PERMISSION);
    }

    public static void actionModitySystemDone() {
        PrefUtil.setKey("done_setted_call_ringtone_permission", true);
        ProgressUtil.sendFinishEvent(GuideConst.CALL_RINGTONE_PERMISSION);
    }

    public static void actionTrustAppDone() {
        PrefUtil.setKey("done_setted_background_protect_permission", true);
        ProgressUtil.sendFinishEvent(GuideConst.TRUST_APPLICATION_PERMISSION);
    }

    public static void actionSystemDialingDone() {
        PrefUtil.setKey("done_setted_system_dialing_permission", true);
        ProgressUtil.sendFinishEvent(GuideConst.SYSTEM_DIALING_PERMISSION);
    }

    public static String getString(int i) {
        return BaseUtil.getAppContext().getString(i);
    }
}
